package com.neuedu.hw20190214;

public class HourlyEmployee extends ColaEmployee {
    //成员方法
    private int perHourSalary;
    private int workHours;


    //行为方法：按小时拿工资员工工资计算
    public int getSalary(int month) {
        if (workHours>160) {
            int sumSalary=(int)(160*perHourSalary+(workHours-160)*perHourSalary*1.5);
            if (super.getBirthMonth() == month) {
                return sumSalary + 100;
            }
            return sumSalary;
        }
        return perHourSalary*workHours;
    }

    //有参构造器
    public HourlyEmployee(String emName, int birthMonth, int perHourSalar, int workHours) {
        super(emName, birthMonth);
        this.perHourSalary = perHourSalar;
        this.workHours = workHours;
    }

    //setter和getter方法

    public int getPerHourSalar() {
        return perHourSalary;
    }

    public void setPerHourSalar(int perHourSalar) {
        this.perHourSalary = perHourSalar;
    }

    public int getWorkHours() {
        return workHours;
    }

    public void setWorkHours(int workHours) {
        this.workHours = workHours;
    }
}
